//   Copyright 2012,2013 Vaughn Vernon
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.

package com.saasovation.common.event;

import java.util.List;

import com.saasovation.common.domain.model.DomainEvent;

/**
 * 事件存储
 */
public interface EventStore {
    /**
     * 获取期间内所有已存储的事件清单
     * @param aLowStoredEventId         低存储事件ID
     * @param aHighStoredEventId        高存储事件ID
     * @return      返回列表
     */
    public List<StoredEvent> allStoredEventsBetween(long aLowStoredEventId, long aHighStoredEventId);

    /**
     * 获取此后所有已存储的事件清单
     * @param aStoredEventId            已存储事件ID
     * @return      返回列表
     */
    public List<StoredEvent> allStoredEventsSince(long aStoredEventId);

    /**
     * 追加（领域事件）
     * @param aDomainEvent  领域事件
     * @return              返回已存储事件
     */
    public StoredEvent append(DomainEvent aDomainEvent);

    /**
     * 关闭
     */
    public void close();

    /**
     * 获取存储事件数
     * @return  返回长整型
     */
    public long countStoredEvents();
}
